//
//  XueLiViewController.m
//  YaDiuDiu
//
//  Created by 欧洪飞 on 2017/9/2.
//  Copyright © 2017年 jy. All rights reserved.
//

#import "XueLiViewController.h"

#import "XueLiDetViewController.h"
@interface XueLiViewController ()
@property (weak, nonatomic) IBOutlet UITextField *textName;
@property (weak, nonatomic) IBOutlet UITextField *textIDCard;

@end

@implementation XueLiViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self showNav:@"学历认证"];
    
}

//学历认证
- (IBAction)clickSave:(id)sender {
    
    NSString *str = [NSString stringWithFormat:@"%@890d69e502d1d37a9e84335ccefece57",[user objectForKey:@"token2"]];
    NSString *token = [LCMD5Tool md5:str];
    NSMutableDictionary *parmas = [NSMutableDictionary dictionary];
    [parmas setObject:token forKey:@"verifyToken"];
    [parmas setObject:[user objectForKey:@"userid"] forKey:@"userid"];
    [parmas setObject:_textIDCard.text forKey:@"id"];
    [parmas setObject:_textName.text forKey:@"username"];
    
    NSString *url = [NSString stringWithFormat:@"%@/App/Usercenter/education",urlHead];
    [[AFHTTPSessionManager manager] POST:url parameters:parmas success:^(NSURLSessionDataTask *task, id responseObject) {
        NSLog(@"学历认证res:%@",responseObject);
        NSString *state = [NSString stringWithFormat:@"%li",[[responseObject objectForKey:@"status"] integerValue]];
        NSString *msg = [responseObject objectForKey:@"msg"];
        if ([state integerValue] == 200) {
            XueLiDetViewController *det = [[XueLiDetViewController alloc] init];
            [self.navigationController pushViewController:det animated:YES];
        }else{
            [SVProgressHUD showErrorWithStatus:msg];
        }
        
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        NSLog(@"error:%@",error);
    }];
    
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [[UIApplication sharedApplication].keyWindow endEditing:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
